home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group94a.txt
/
000099_icon-group-sender _Mon Apr 25 08:12:44 1994.msg
< prev
next >
Wrap
Internet Message Format
|
1994-08-19
|
1KB
Received: by cheltenham.cs.arizona.edu; Mon, 25 Apr 1994 09:25:47 MST
Date: Mon, 25 Apr 94 08:12:44 PDT
From: kwalker@sirtur.premenos.com (Ken Walker)
Message-Id: <9404251512.AA00951@sirtur.premenos.com>
To: icon-group@cs.arizona.edu
Subject: pointer semantics
X-Sun-Charset: US-ASCII
Content-Length: 1002
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
> From: <janpeter@mpi.kun.nl>
> Subject: Re: is this a bug?
>
> For example, the following fragments do not have the same
> meaning:
>
> # first fragment
> t := table([])
> put(t[1],"john")
> put(t[2],"mary")
>
> # second fragment
> t := table([])
> t[1] |||:= ["john"]
> t[2] |||:= ["mary"]
>
> Which is a pity, I think, for a higher level language where
> you're supposed to be free of these details
A simplified example is:
L := []
put(L, "john")
L := []
L |||:= ["john"]
In the first case, you are modifying the list and in the second case you
are constructing a new list and assigning it to L. The "problem" is
inherent in an imperative language with pointer semantics. While it is
true that efficiency is one reason for having pointer semantics, pointer
semantics is also very convenient. You can modify part of a complex
data structure without being forced to rebuild the whole thing and pass
the changes on to everything that needs it.
Ken Walker, kwalker@premenos.com